//
//  LGReportDetailFileCell.m
//  HeartDiseaseManage
//
//  Created by Bovin on 2023/5/25.
//

#import "LGReportDetailFileCell.h"

@interface LGReportDetailFileCell()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIImageView *iconView;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;

@end

@implementation LGReportDetailFileCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setTitle:(NSString *)title{
    _title = title;
    self.titleLabel.text = title;
}

-(void)checkFileInformation{
    
}

-(void)createSubView{
    self.clipsToBounds = YES;
    self.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.baseView];
    [self.contentView addSubview:self.iconView];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.checkBtn];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.equalTo(self.contentView).offset(viewPix(16));
        make.top.right.equalTo(self.contentView).offset(-viewPix(16));
    }];
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.baseView).offset(viewPix(22));
        make.centerY.equalTo(self.baseView);
        make.width.height.equalTo(@(viewPix(16)));
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).offset(4);
        make.right.equalTo(self.checkBtn.mas_left).offset(-5);
        make.centerY.equalTo(self.iconView);
    }];
    [self.checkBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(12));
        make.top.equalTo(self.contentView).offset(5);
        make.bottom.equalTo(self.contentView).offset(-3);
        make.width.equalTo(@(viewPix(78)));
        make.height.equalTo(@(viewPix(28)));
    }];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:10];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIImageView *)iconView{
    if(!_iconView){
        _iconView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"报告详情-PDF"]];
    }
    return _iconView;
}


-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#666666" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _titleLabel;
}

-(UIButton *)checkBtn{
    if(!_checkBtn){
        _checkBtn = [UIButton buttonWithTitle:@"查看" titleFont:LGFontWeight(15, UIFontWeightMedium) textColor:@"#FFFFFF" imageName:@""];
        _checkBtn.backgroundColor = [UIColor colorWithString:@"#3291FF"];
        _checkBtn.cornerRidus = viewPix(14);
        [_checkBtn addTarget:self action:@selector(checkFileInformation) forControlEvents:UIControlEventTouchUpInside];
    }
    return _checkBtn;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
